package com.zwz.enums;

/**
 * 错误异常CODE定义
 * @author zwz
 *
 */
public enum BllConstantEnum {
	
	RESCODE_0(0,"操作成功"),
	RESCODE_1(1,"服务器发生异常"),
	RESCODE_2(2,"请求参数错误或消息体解析失败"),
	RESCODE_3(3,"操作失败!")
 	;
	
	/**
	 * 枚举的值
	 * */
	private long code;
	
	/**
	 * 枚举的中文描述
	 * */
	private String desc;
	
	public static String getDesc(long code) {
		for(BllConstantEnum b:BllConstantEnum.values()){
			if(b.code==code){
				return b.desc;
			}
		}
		return "";
	}
	public static BllConstantEnum getBllConstantEnum(long code) {
		for(BllConstantEnum b:BllConstantEnum.values()){
			if(b.code==code){
				return b;
			}
		}
		return BllConstantEnum.RESCODE_0;
	}
	private BllConstantEnum(int code,String desc){
		this.code = code;
		this.desc = desc;
	}

	public long getCode() {
		return code;
	}

	public void setCode(long code) {
		this.code = code;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	
}
